from pymodis import convertmodis_gdal
import os
MODIS_FILE_DIR = 'F:/16satellite/data/china/'
out_pre = 'F:/16satellite/data/output/'
Modis_List = os.listdir(MODIS_FILE_DIR)

for one_modis in Modis_List:
    in_file = MODIS_FILE_DIR + one_modis
    (filename, extension) = os.path.splitext(one_modis)

    subset = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    out = out_pre + filename
    print(out)
    mds = convertmodis_gdal.convertModisGDAL(
        in_file, out, subset, 0.1, outformat='GTiff', epsg=4326, wkt=None, resampl='NEAREST_NEIGHBOR', vrt=False)
    mds.run()
